﻿using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Data;
using System.Linq;
using System.Runtime.Serialization;
using System.Text;

namespace CommunitySystemModel
{
    public class GuaZhiEmpModel
    {
        private ObservableCollection<GuaZhi_AttatchmentModel> _Attachment = new ObservableCollection<GuaZhi_AttatchmentModel>();

        [DataMember]
        public ObservableCollection<GuaZhi_AttatchmentModel> Attachment
        {
            get { return _Attachment; }
            set { _Attachment = value; }
        }

        private bool isselected = false;
        [DataMember]
        public bool IsSelected
        {
            get { return isselected; }
            set { isselected = value; }
        }
        private int _Sec;
        [DataMember]
        public int Sec
        {
            get { return _Sec; }
            set { _Sec = value; }
        }
        private int _ID;
        [DataMember]
        public int ID
        {
            get { return _ID; }
            set { _ID = value; }
        }
        private int _EmpbasicID;
        [DataMember]
        public int EmpbasicID
        {
            get { return _EmpbasicID; }
            set { _EmpbasicID = value; }
        }

        private int _OrgID;
        [DataMember]
        public int OrgID
        {
            get { return _OrgID; }
            set { _OrgID = value; }
        }

        private string _Status;
        [DataMember]
        public string Status
        {
            get { return _Status; }
            set { _Status = value; }
        }

        private string _OrgName;
        [DataMember]
        public string OrgName
        {
            get { return _OrgName; }
            set { _OrgName = value; }
        }

        private string _Name;
        [DataMember]
        public string Name
        {
            get { return _Name; }
            set { _Name = value; }
        }
        private string _Gender;
        [DataMember]
        public string Gender
        {
            get { return _Gender; }
            set { _Gender = value; }
        }
        private string _Political;
        [DataMember]
        public string Political
        {
            get { return _Political; }
            set { _Political = value; }
        }
        private string _EducationName;
        [DataMember]
        public string EducationName
        {
            get { return _EducationName; }
            set { _EducationName = value; }
        }
        private string _DegreeName;
        [DataMember]
        public string DegreeName
        {
            get { return _DegreeName; }
            set { _DegreeName = value; }
        }
        private string _DutyName;
        [DataMember]
        public string DutyName
        {
            get { return _DutyName; }
            set { _DutyName = value; }
        }
        private string _DutyNo;
        [DataMember]
        public string DutyNo
        {
            get { return _DutyNo; }
            set { _DutyNo = value; }
        }
        private string _DutyLevel;
        [DataMember]
        public string DutyLevel
        {
            get { return _DutyLevel; }
            set { _DutyLevel = value; }
        }
        private string _Demo;
        [DataMember]
        public string Demo
        {
            get { return _Demo; }
            set { _Demo = value; }
        }
        private string _Reason;
        [DataMember]
        public string Reason
        {
            get { return _Reason; }
            set { _Reason = value; }
        }
        private string _GuaZhiOrgName;
        [DataMember]
        public string GuaZhiOrgName
        {
            get { return _GuaZhiOrgName; }
            set { _GuaZhiOrgName = value; }
        }
        private string _GuaZhiZhiWu;
        [DataMember]
        public string GuaZhiZhiWu
        {
            get { return _GuaZhiZhiWu; }
            set { _GuaZhiZhiWu = value; }
        }
        private string _ZhongZhiReason;
        [DataMember]
        public string ZhongZhiReason
        {
            get { return _ZhongZhiReason; }
            set { _ZhongZhiReason = value; }
        }
        private string _YanQiReason;
        [DataMember]
        public string YanQiReason
        {
            get { return _YanQiReason; }
            set { _YanQiReason = value; }
        }
        private string _DutyAttribute;
        [DataMember]
        public string DutyAttribute
        {
            get { return _DutyAttribute; }
            set { _DutyAttribute = value; }
        }
        private DateTime? _Birthday;
        [DataMember]
        public DateTime? Birthday
        {
            get { return _Birthday; }
            set { _Birthday = value; }
        }
        private DateTime? _NowWorkDate;
        [DataMember]
        public DateTime? NowWorkDate
        {
            get { return _NowWorkDate; }
            set { _NowWorkDate = value; }
        }
        private DateTime? _ZhongZhiDate;
        [DataMember]
        public DateTime? ZhongZhiDate
        {
            get { return _ZhongZhiDate; }
            set { _ZhongZhiDate = value; }
        }
        private DateTime? _YanQiDate;
        [DataMember]
        public DateTime? YanQiDate
        {
            get { return _YanQiDate; }
            set { _YanQiDate = value; }
        }

        private int _GuaZhiOrgID;
        [DataMember]
        public int GuaZhiOrgID
        {
            get { return _GuaZhiOrgID; }
            set { _GuaZhiOrgID = value; }
        }
        private int _GuaZhiShangJiOrgID;
        [DataMember]
        public int GuaZhiShangJiOrgID
        {
            get { return _GuaZhiShangJiOrgID; }
            set { _GuaZhiShangJiOrgID = value; }
        }
        private int _JiHuaID;
        [DataMember]
        public int JiHuaID
        {
            get { return _JiHuaID; }
            set { _JiHuaID = value; }
        }
        private int _Age;
        [DataMember]
        public int Age
        {
            get { return _Age; }
            set { _Age = value; }
        }
        private DateTime? _GuaZhiBeginDate;
        [DataMember]
        public DateTime? GuaZhiBeginDate
        {
            get { return _GuaZhiBeginDate; }
            set { _GuaZhiBeginDate = value; }
        }
        private string _ShiJianAnPai;
        [DataMember]
        public string ShiJianAnPai
        {
            get { return _ShiJianAnPai; }
            set { _ShiJianAnPai = value; }
        }
        private DateTime? _JobDate = null;
        [DataMember]
        public DateTime? JobDate
        {
            get { return _JobDate; }
            set { _JobDate = value; }
        }
        private string _RXRZWSXSJ = string.Empty;
        [DataMember]
        public string RXRZWSXSJ
        {
            get { return _RXRZWSXSJ; }
            set { _RXRZWSXSJ = value; }
        }
        private string _YanQiStatus;
        [DataMember]
        public string YanQiStatus
        {
            get { return _YanQiStatus; }
            set { _YanQiStatus = value; }
        }
        public static GuaZhiEmpModel FillEntity(DataRow dr)
        {
            GuaZhiEmpModel right = new GuaZhiEmpModel();
            if (dr.Table != null && dr.Table.Columns.Contains("IsSelected")) if (!string.IsNullOrEmpty(dr["IsSelected"].ToString())) right.IsSelected = dr["IsSelected"].ToString() == "false" ? false : true;
            if (dr.Table != null && dr.Table.Columns.Contains("EmpbasicID")) if (!string.IsNullOrEmpty(dr["EmpbasicID"].ToString())) right.EmpbasicID = Convert.ToInt32(dr["EmpbasicID"]);
            if (dr.Table != null && dr.Table.Columns.Contains("OrgID")) if (!string.IsNullOrEmpty(dr["OrgID"].ToString())) right.OrgID = Convert.ToInt32(dr["OrgID"]);
            if (dr.Table != null && dr.Table.Columns.Contains("Sec")) if (!string.IsNullOrEmpty(dr["Sec"].ToString())) right.Sec = Convert.ToInt32(dr["Sec"]);
            if (dr.Table != null && dr.Table.Columns.Contains("ID")) if (!string.IsNullOrEmpty(dr["ID"].ToString())) right.ID = Convert.ToInt32(dr["ID"]);
            if (dr.Table != null && dr.Table.Columns.Contains("JiHuaID")) if (!string.IsNullOrEmpty(dr["JiHuaID"].ToString())) right.JiHuaID = Convert.ToInt32(dr["JiHuaID"]);
            if (dr.Table != null && dr.Table.Columns.Contains("OrgName")) if (!string.IsNullOrEmpty(dr["OrgName"].ToString())) right.OrgName = dr["OrgName"].ToString();
            if (dr.Table != null && dr.Table.Columns.Contains("Name")) if (!string.IsNullOrEmpty(dr["Name"].ToString())) right.Name = dr["Name"].ToString();
            if (dr.Table != null && dr.Table.Columns.Contains("YanQiStatus")) if (!string.IsNullOrEmpty(dr["YanQiStatus"].ToString())) right.YanQiStatus = dr["YanQiStatus"].ToString();
            if (dr.Table != null && dr.Table.Columns.Contains("Gender")) if (!string.IsNullOrEmpty(dr["Gender"].ToString())) right.Gender = dr["Gender"].ToString();
            if (dr.Table != null && dr.Table.Columns.Contains("Political")) if (!string.IsNullOrEmpty(dr["Political"].ToString())) right.Political = dr["Political"].ToString();
            if (dr.Table != null && dr.Table.Columns.Contains("EducationName")) if (!string.IsNullOrEmpty(dr["EducationName"].ToString())) right.EducationName = dr["EducationName"].ToString();
            if (dr.Table != null && dr.Table.Columns.Contains("DegreeName")) if (!string.IsNullOrEmpty(dr["DegreeName"].ToString())) right.DegreeName = dr["DegreeName"].ToString();
            if (dr.Table != null && dr.Table.Columns.Contains("DutyName")) if (!string.IsNullOrEmpty(dr["DutyName"].ToString())) right.DutyName = dr["DutyName"].ToString();
            if (dr.Table != null && dr.Table.Columns.Contains("DutyNo")) if (!string.IsNullOrEmpty(dr["DutyNo"].ToString())) right.DutyNo = dr["DutyNo"].ToString();
            if (dr.Table != null && dr.Table.Columns.Contains("DutyLevel")) if (!string.IsNullOrEmpty(dr["DutyLevel"].ToString())) right.DutyLevel = dr["DutyLevel"].ToString();
            if (dr.Table != null && dr.Table.Columns.Contains("DutyAttribute")) if (!string.IsNullOrEmpty(dr["DutyAttribute"].ToString())) right.DutyAttribute = dr["DutyAttribute"].ToString();
            if (dr.Table != null && dr.Table.Columns.Contains("Demo")) if (!string.IsNullOrEmpty(dr["Demo"].ToString())) right.Demo = dr["Demo"].ToString();
            if (dr.Table != null && dr.Table.Columns.Contains("Reason")) if (!string.IsNullOrEmpty(dr["Reason"].ToString())) right.Reason = dr["Reason"].ToString();
            if (dr.Table != null && dr.Table.Columns.Contains("Status")) if (!string.IsNullOrEmpty(dr["Status"].ToString())) right.Status = dr["Status"].ToString();
            if (dr.Table != null && dr.Table.Columns.Contains("GuaZhiOrgName")) if (!string.IsNullOrEmpty(dr["GuaZhiOrgName"].ToString())) right.GuaZhiOrgName = dr["GuaZhiOrgName"].ToString();
            if (dr.Table != null && dr.Table.Columns.Contains("GuaZhiZhiWu")) if (!string.IsNullOrEmpty(dr["GuaZhiZhiWu"].ToString())) right.GuaZhiZhiWu = dr["GuaZhiZhiWu"].ToString();
            if (dr.Table != null && dr.Table.Columns.Contains("ZhongZhiReason")) if (!string.IsNullOrEmpty(dr["ZhongZhiReason"].ToString())) right.ZhongZhiReason = dr["ZhongZhiReason"].ToString();
            if (dr.Table != null && dr.Table.Columns.Contains("YanQiReason")) if (!string.IsNullOrEmpty(dr["YanQiReason"].ToString())) right.YanQiReason = dr["YanQiReason"].ToString();
            if (dr.Table != null && dr.Table.Columns.Contains("ShiJianAnPai")) if (!string.IsNullOrEmpty(dr["ShiJianAnPai"].ToString())) right.ShiJianAnPai = dr["ShiJianAnPai"].ToString();
            if (dr.Table != null && dr.Table.Columns.Contains("Birthday")) if (!string.IsNullOrEmpty(dr["Birthday"].ToString()) && Convert.ToDateTime(dr["Birthday"]) != Convert.ToDateTime("1900-01-01"))
            {
                right.Birthday = Convert.ToDateTime(dr["Birthday"]);
                right.Age = DateTime.Today.Year - Convert.ToDateTime(right.Birthday).Year;
            }
            if (dr.Table != null && dr.Table.Columns.Contains("JobDate")) if (!string.IsNullOrEmpty(dr["JobDate"].ToString()) && Convert.ToDateTime(dr["JobDate"]) != Convert.ToDateTime("1900-01-01")) right.JobDate = (DateTime?)dr["JobDate"];
            if (dr.Table != null && dr.Table.Columns.Contains("RXRZWSXSJ")) if (!string.IsNullOrEmpty(dr["RXRZWSXSJ"].ToString())) right.RXRZWSXSJ = dr["RXRZWSXSJ"].ToString();
            if (dr.Table != null && dr.Table.Columns.Contains("NowWorkDate")) if (!string.IsNullOrEmpty(dr["NowWorkDate"].ToString()) && Convert.ToDateTime(dr["NowWorkDate"]) != Convert.ToDateTime("1900-01-01")) right.NowWorkDate = Convert.ToDateTime(dr["NowWorkDate"]);
            if (dr.Table != null && dr.Table.Columns.Contains("ZhongZhiDate")) if (!string.IsNullOrEmpty(dr["ZhongZhiDate"].ToString()) && Convert.ToDateTime(dr["ZhongZhiDate"]) != Convert.ToDateTime("1900-01-01")) right.ZhongZhiDate = Convert.ToDateTime(dr["ZhongZhiDate"]);
            if (dr.Table != null && dr.Table.Columns.Contains("YanQiDate")) if (!string.IsNullOrEmpty(dr["YanQiDate"].ToString()) && Convert.ToDateTime(dr["YanQiDate"]) != Convert.ToDateTime("1900-01-01")) right.YanQiDate = Convert.ToDateTime(dr["YanQiDate"]);
            if (dr.Table != null && dr.Table.Columns.Contains("GuaZhiBeginDate")) if (!string.IsNullOrEmpty(dr["GuaZhiBeginDate"].ToString()) && Convert.ToDateTime(dr["GuaZhiBeginDate"]) != Convert.ToDateTime("1900-01-01")) right.GuaZhiBeginDate = Convert.ToDateTime(dr["GuaZhiBeginDate"]);

            if (dr.Table != null && dr.Table.Columns.Contains("GuaZhiOrgID")) if (!string.IsNullOrEmpty(dr["GuaZhiOrgID"].ToString())) right.GuaZhiOrgID = Convert.ToInt32(dr["GuaZhiOrgID"]);
            if (dr.Table != null && dr.Table.Columns.Contains("GuaZhiShangJiOrgID")) if (!string.IsNullOrEmpty(dr["GuaZhiShangJiOrgID"].ToString())) right.GuaZhiShangJiOrgID = Convert.ToInt32(dr["GuaZhiShangJiOrgID"]);
            return right;
        }
    }
}
